package softtech.app.secretcaller;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

public class AdapterFakeIcon extends ArrayAdapter<Integer> {

	int[] arrIconFake = {
		R.drawable.ic_fake_app1 , R.drawable.ic_fake_app2 ,
		R.drawable.ic_fake_app3, R.drawable.ic_fake_app4,
		R.drawable.ic_fake_app5, R.drawable.ic_fake_app6
	};
	
	Context mContext;
	
	private int selectedPosition;
	
	public AdapterFakeIcon(Context context, int textViewResourceId) {
		super(context, textViewResourceId);
		mContext = context;
		selectedPosition = -1;
	}

	@Override
	public int getCount() {

		return arrIconFake.length;
	}

	
	
	@Override
	public Integer getItem(int position) {
		return arrIconFake[position];
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = LayoutInflater.from(parent.getContext());
		convertView = inflater.inflate(R.layout.item_fake_app
				,parent, false);
		if(position == selectedPosition){
			convertView.setBackgroundColor(Color.parseColor("#C86050"));
		}
		ImageView imgContentApp = (ImageView) convertView.findViewById(R.id.imgImageFakeApp);
		imgContentApp.setImageResource(arrIconFake[position]);
		return convertView;
	}

	public int getSelectedPosition() {
		return selectedPosition;
	}

	public void setSelectedPosition(int selectedPosition) {
		this.selectedPosition = selectedPosition;
	}

}
